Skip to content

Add a test case related to spreading objects#57642

Merged
RyanCavanaugh merged 1 commit into
microsoft:mainfrom
Andarist:tests/spread-no-circular
Mar 4, 2024
Merged

Add a test case related to spreading objects#57642
RyanCavanaugh merged 1 commit into
microsoft:mainfrom
Andarist:tests/spread-no-circular

Conversation

@Andarist

@Andarist Andarist commented Mar 4, 2024

Copy link
Copy Markdown
Contributor

test case for #48178
it was fixed by #53413

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Mar 4, 2024
@typescript-bot

Copy link
Copy Markdown
Contributor

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@RyanCavanaugh RyanCavanaugh merged commit 0f6f7c3 into microsoft:main Mar 4, 2024
@jakebailey

Copy link
Copy Markdown
Member

#53413 shouldn't have fixed anything, so I do wonder what the heck I did...

@Andarist

Andarist commented Mar 5, 2024

Copy link
Copy Markdown
Contributor Author

@jakebailey the circularity was caused by subtype reduction - ur PR avoids it in certain cases and thus it accidentally~ fixed this issue

@Andarist

Andarist commented Mar 5, 2024

Copy link
Copy Markdown
Contributor Author

I re-checked and at the time the circularity was encountered by the subtype reduction we can see those types when we get to your optimization:

typeToString(getTypeOfSymbol(leftProp)) // Foo | Box
typeToString(rightType) // Foo | Box | undefined

So it makes sense that we don't get to the circularity now since u avoid that subtype reduction based on this check:

result.links.type = leftTypeWithoutUndefined === rightTypeWithoutUndefined ? leftType : getUnionType([leftType, rightTypeWithoutUndefined], UnionReduction.Subtype);

I'd call it - "accidental but good" :P

@Andarist Andarist deleted the tests/spread-no-circular branch March 5, 2024 07:25
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants